<?php

class Ingenii_Module extends Ingenii_Core {
	
	protected $environment;
	protected $parameters;
	
	public function __construct(Doctrine_Collection $parameters) {
		$this->setParameters($parameters);
	}
	
	public function run() { echo "Module not yet defined"; }
	
	/**
	 * Returns a module class
	 * @param string $classname
	 * @return Ingenii_Module
	 */
	public static function returnModule($className, $parameters) {
		return new $className($parameters);
	}
	
	protected function setEnvironment($env) {
		$this->environment = $env;
	}

	protected function setParameters(Doctrine_Collection $parameters) {
		$this->parameters = new stdClass();
		foreach($parameters as $param) {
			$this->parameters->{$param->name} = $param->value;
		}
	}
}